-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(IamAssumeAuthenticator): introduce a new authenticator #211
Conversation
c7a7a40
to
acf5561
Compare
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
acf5561
to
99ea907
Compare
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, although I was able to demonstrate my reviewer's prowess by finding a couple of small typos 😂
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
2d1548c
to
36425f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just want to make sure we're handling the refresh token consistently with Node, and had one other question for my own edification
@@ -66,6 +66,7 @@ class ContainerAuthenticator(IAMRequestBasedAuthenticator): | |||
|
|||
def __init__( | |||
self, | |||
*, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this change doing? Appreciate your patience with my lack of Python knowledge 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arguments before the asterisk are positional argument, so they can be passed like call_function(1, 2)
. Arguments after the *
become keyword only, so they cannot be used in the previous way, only like this: call_function(a=1, b=2)
. It's not advised to have too many positional arguments because for example to specify the last one, you have to specify all the previous one too. Since they are used by their position not their keyword.
TLDR; there is a new pylint
rule that complains about this.
Yes, this changes the behavior a little, but I don't think this would be a breaking change. If we start getting negative feedback, we can restore the original behavior pretty easily and exclude the affected functions/methods from the linter.
assert token_manager.request_payload.get('account_id') is None | ||
|
||
# The final result should be the other access token, which belong to the "assume" request. | ||
assert access_token == OTHER_ACCESS_TOKEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you add an assertion that the refresh token is not set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. It turned out I only made this change in the authenticator and not in the token manager, so all these properties were accessible: refresh_token
, client_id
, client_secret
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is it also the case that the client ID and secret will, if set, be used in the IAM delegate request but not in the assume request?
66a9949
to
983e335
Compare
raise AttributeError(f"'IAMAssumeAuthenticator' has no attribute '{name}'") | ||
raise AttributeError(f"'{self.__class__.__name__}' has no attribute '{name}'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we won't have to care about changing this if we decide to rename the class. :)
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
983e335
to
872c678
Compare
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
f9617ee
to
e8f1a42
Compare
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
ae7ead8
to
db84a5e
Compare
…henticator Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
db84a5e
to
85bc3f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes look good.
Signed-off-by: Norbert Biczo <pyrooka@users.noreply.github.com>
5204511
to
5fa39f0
Compare
# [3.22.0](v3.21.0...v3.22.0) (2024-10-15) ### Features * **IAMAssumeAuthenticator:** introduce a new authenticator ([#211](#211)) ([29a8eb7](29a8eb7))
🎉 This PR is included in version 3.22.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This commit introduces the new
IAMAssumeAuthenticator
which will fetch an IAM access token using the IAMget_token
operation's "assume" grant type. The resulting access token allows the application to assume the identity of a trusted profile, similar to the "sudo" feature of Linux.